home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Loadstar Extras 3
/
Ex3side2.d64
/
input dir source
< prev
next >
Wrap
Text File
|
2022-08-28
|
3KB
|
270 lines
open =$ffc0
readst =$ffb7
setlfs =$ffba
setnam =$ffbd
load =$ffd5
getin =$ffe4
clrchn =$ffcc
close =$ffc3 ;a
chrin =$ffcf
chkout =$ffc9 ;x
chkin =$ffc6 ;x
plot =$fff0
chrout =$ffd2
color'pointer =243
screen'line'pointer =209
print'number =$bdcd ;x,a
clear'line =59903
error'string =$200
buffer =$200
.org $c000
.mem
;obj "input dir c000"
;dis
lda #0
sta sub'low
sta sub'high
jsr get'string
pha
tya
pha
txa
pha
jsr get'number
sty device
jsr get'number
sty sub'low
sta sub'high
jsr open'error
pla
tax
pla
tay
pla
jsr setnam
lda #2
jsr close
lda #2
ldx device
ldy #0
jsr setlfs
jsr open
jsr clrchn
jsr read'open'error
jsr clrchn
ldx #2
jsr chkin
lda buffer
cmp "0"
beq get'name
jsr clear'buffer
lda #15
jsr close
lda #2
jsr close
jmp clrchn
get'name ldy #6
- jsr getin
dey
bpl -
ldy #0
- jsr getin
sta buffer,y
iny
cpy #24
bne -
sty wlength
jsr make'fstring
jsr find'next
get'line ldy #0
sty wlength
- jsr getin
cmp #34
bne +
- jsr make'fstring
jsr find'next
jsr readst
and #64
beq get'line
jmp quit
+ sta buffer,y
iny
inc wlength
cpy #87
bcc +
bcs -
+ jsr readst
and #64
beq --
bne -
quit lda sub'low
ldx sub'high
sta 251
stx 252
lda #2
jsr close
jsr clrchn
jsr read'open'error
jsr clrchn
jsr clear'buffer
lda #15
jmp close
rts
open'error lda #15
jsr close
lda #15
ldx device
ldy #15
jsr setlfs
lda #3
ldy >initialize'name
ldx <initialize'name
jsr setnam
jmp open
;***** get string from BASIC ****
get'string jsr $aefd
jsr $ad9e
jsr $b6a3
ldx $22
ldy $23
rts
get'number jsr $aefd
jsr $ad8a
jmp $b7f7
read'error jsr open'error
read'open'error ldx #15
jsr chkin
ldy #0
- jsr getin
sta error'string,y
iny
cmp #13
bne -
iny
sty elength
jsr clrchn
ldx <error'name
ldy >error'name
jsr locvar
lda <elength
ldy >elength
jmp set'string
locvar lda $7a
pha
lda $7b
pha
stx $7a
sty $7b
jsr $b08b
sta $49
sty $4a
pla
sta $7b
pla
sta $7a
rts
set'string sta $64
sty $65
jmp $aa52
make'fstring ldy #3
lda " "
- sta string'name+3,y
dey
bpl -
lda sub'high
ldx sub'low
sta $62
stx $63
ldx #$90
sec
jsr $bc49
jsr $bddf
sta 251
sty 252
ldy #0
- lda (251),y
beq +
sta string'name+3,y
iny
cpy #4
bcc -
+ ldx <string'name
ldy >string'name
jsr locvar
lda <wlength
ldy >wlength
jsr set'string
inc sub'low
bne clear'buffer
inc sub'high
clear'buffer ldy #79
lda #0
- sta buffer,y
dey
bpl -
rts
find'next jsr getin
bne find'next
ldy #3
- jsr getin
dey
bpl -
find'quote jsr getin
sta temp
jsr readst
and #64
bne +
lda temp
cmp #34
bne find'quote
+ rts
string'name .asc "f$(0000)":.byt 0
wlength .byt 0
.word buffer
error'name .asc "e$":.byt 0
elength .byt 0
.word error'string
string'length .byt 0
initialize'name .asc "i0:"
device .byt 8
error'flag .byt 0
temp .byt 0
sub'low .byt 0
sub'high .byt 0